package ca.cbc.giscommon.entity;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "shape_type")
public class ShapeType implements Cloneable, Serializable {
    private static final long serialVersionUID = 7726148422968741494L;
	private long id;
	private String type;
	private Category category;

	public ShapeType() {}
	
	public ShapeType(String type, Category category) {
		this.setType(type);
		this.setCategory(category);
	}
	
	@Override
	public ShapeType clone() throws CloneNotSupportedException {
		return (ShapeType) super.clone();
	}
	
	@ManyToOne
    @JoinColumn(name = "category_id")
	public Category getCategory() {
		return category;
	}
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	public long getId() {
		return id;
	}
	public String getType() {
		return type;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	public void setId(long id) {
		this.id = id;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String toString() {
		return new StringBuffer("ShapeType {id:").append(id)
					.append(", type:").append(type)
					.append(", category:").append(category)
					.append("}")
					.toString();
	}
}
